package day05.exercise;

public class AnyNumberOfIntegersDemo {
    public static void main(String[] args) {
        //编写一个方法，接收任意数量的整数并返回它们的和。
        System.out.println("和是："+Sum(12,45,12,78,46545,123));
        System.out.println("和是："+Sum(51,451,132,874,5));

    }

    public static int Sum(int... numbers) {
        int sum = 0;
        for (int num : numbers) {
            sum += num;
        }
        return sum;
    }

}
